Skip to content

refactor: introduce is_negative_or_typemax#21

Merged
nsajko merged 1 commit intoJuliaArrays:mainfrom
nsajko:a
Feb 21, 2026
Merged

refactor: introduce is_negative_or_typemax#21
nsajko merged 1 commit intoJuliaArrays:mainfrom
nsajko:a

Conversation

@nsajko
Copy link
Copy Markdown
Member

@nsajko nsajko commented Feb 21, 2026

Results in decreased generated code size (code_llvm and code_native).

Results in decreased generated code size (`code_llvm` and
`code_native`).
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.87%. Comparing base (a7521b9) to head (3a2c9a3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #21   +/-   ##
=======================================
  Coverage   96.87%   96.87%           
=======================================
  Files           1        1           
  Lines          32       32           
=======================================
  Hits           31       31           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nsajko nsajko marked this pull request as ready for review February 21, 2026 12:39
@nsajko nsajko merged commit b473ba6 into JuliaArrays:main Feb 21, 2026
14 checks passed
@nsajko nsajko deleted the a branch February 21, 2026 12:42
@nsajko
Copy link
Copy Markdown
Member Author

nsajko commented Feb 21, 2026

BenchmarkTools.jl suggests a speedup (although such a very-micro microbenchmark is perhaps not relevant):

@btime checked_size_product(t) setup=(t = (rand((-1):13), rand((-1):13), rand((-1):13), rand((-1):13));) seconds=Inf samples=100000 evals=200;
#  5.060 ns (0 allocations: 0 bytes)
#  4.755 ns (0 allocations: 0 bytes)

@nsajko
Copy link
Copy Markdown
Member Author

nsajko commented Feb 21, 2026

I think this PR allows LLVM to transform (x < 0) | (x == typemax(x)) to x + 1 < 1. Thus the speedup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant